    <template>
    	<view class="container">
    		<mumu-get-qrcode @success='qrcodeSucess' @error="qrcodeError"></mumu-get-qrcode>
    	</view>
    </template>

    <script>
    	import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'

    	export default {
    		components: {
    			mumuGetQrcode //注册
    		},
    		data() {
    			return {}
    		},
    		name: 'Qrcode',
    		methods: {
    			qrcodeSucess(data) { //扫码成功
				let url=this.getDizhiValue(data);
					console.log("打印入参地址",url);
					this.$tab.navigateTo('/pages/duihuan/erweima?dizhi='+encodeURIComponent(url))
					// window.location.href = data
    				// 确认弹窗（若不需要可以去除）
    				// uni.showModal({
    				// 	title: '成功',
    				// 	content: data,
    				// 	success: () => { // 确认弹窗后的操作 
    				// 	}
    				// })
    			},
				 getDizhiValue(url) {
				      const queryString = url.split('?')[1] || '';
				      const params = queryString.split('&');
				
				      for (const param of params) {
				        const [key, value] = param.split('=');
				        if (key === 'dizhi') {
				          return decodeURIComponent(value || ''); // 返回解码的值
				        }
				      }
				      return ''; // 未找到时返回空字符串
				    },
    			qrcodeError(err) { //扫码失败
    				uni.showModal({
    					title: '摄像头授权失败',
    					content: '摄像头授权失败，请检测当前浏览器是否有摄像头权限。',
    					success: () => {
    						uni.navigateBack({}) //返回到上一页
    					}
    				})
    			}
    		}
    	};
    </script>